package GUI;


import Model.BorrowLend;
import Model.InfoImportExport;
import Model.InfoPrivilege;
import Model.InfoBorrowLend;
import Control.User;
import Control.rsTableModel;
import Control.Privilege;
import Control.ImportExport;
import Control.Database;
import Control.ComboxRender;
import java.awt.Color;
import java.awt.Component;
import java.awt.FileDialog;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.LayoutManager;
import java.awt.PopupMenu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.plaf.basic.BasicBorders;
import net.coobird.thumbnailator.Thumbnails;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.Align;
import org.jfree.data.*;
import org.jfree.data.general.DefaultPieDataset;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author dodan_000
 */
public class Main extends javax.swing.JFrame {

    /**
     * Creates new form Main
     */
    User user = new User();
    ImportExport importExport = new ImportExport();
    BorrowLend borrowLend = new BorrowLend();
    Privilege privilege = new Privilege();
    StatisticsChartFrame statisticsChartFrame;
    ArrayList<String> importTypeList = new ArrayList<String>();
    ArrayList<String> exportTypeList = new ArrayList<String>();
    ArrayList<String> userList = new ArrayList<String>();

    @Override
    public Component add(Component comp, int index) {
        return super.add(comp, index); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void add(Component comp, Object constraints) {
        super.add(comp, constraints); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void add(PopupMenu popup) {
        super.add(popup); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Component add(Component comp) {
        return super.add(comp); //To change body of generated methods, choose Tools | Templates.
    }
    
    public Main(String userName) {
        Database.setState();// test
        initComponents();
        setImportTypeList(importExport.getImportTypeList());
        setExportTypeList(importExport.getExportTypeList());
        setUserList(user.getUserList());   
        this.setUser(userName);
        statisticsChartFrame = new StatisticsChartFrame(user.userName);
        
        
        layerBorrowLend.setVisible(false);
        layerImportExport.setVisible(false);
        layerAccountSettings.setVisible(false);
        layerStatistics.setVisible(false);
        layerMenu.setVisible(true);
        initLayerAccountSettings();
        initLayerStatistics();
        initLayerImportExport();
    }
    
    
    private void setImportTypeList(ArrayList<String> importTypeList){
        this.importTypeList = importTypeList;
    }
    private void setExportTypeList(ArrayList<String> exportTypeList){
        this.exportTypeList = exportTypeList;
    }
    private void setUserList(ArrayList<String> userList){
        this.userList = userList;
    }
    public void setUser(String userName){
        user.userName = userName;
        user.id = user.getUserId(userName);
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup = new javax.swing.ButtonGroup();
        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();
        jInternalFrame1 = new javax.swing.JInternalFrame();
        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        layerMenu = new javax.swing.JLayeredPane();
        jDesktopPane3 = new javax.swing.JDesktopPane();
        jpMain = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        btnAddImportExport = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        layerStatistics = new javax.swing.JLayeredPane();
        jDesktopPane4 = new javax.swing.JDesktopPane();
        jpThongKe = new javax.swing.JPanel();
        jdcEndDay = new com.toedter.calendar.JDateChooser();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        cboxStatisticsType = new javax.swing.JComboBox();
        cboxStatisticsUser = new javax.swing.JComboBox();
        btThucHien = new javax.swing.JButton();
        jScrollPane9 = new javax.swing.JScrollPane();
        tbBangThongKe = new javax.swing.JTable();
        rbtThuNhap = new javax.swing.JRadioButton();
        rbtChiTieu = new javax.swing.JRadioButton();
        lbTong = new javax.swing.JLabel();
        jdcStartDay = new com.toedter.calendar.JDateChooser();
        btCharThu = new javax.swing.JButton();
        jCheckBox1 = new javax.swing.JCheckBox();
        layerAccountSettings = new javax.swing.JLayeredPane();
        dpAccountSettings = new javax.swing.JDesktopPane();
        jpAccount = new javax.swing.JPanel();
        jtpAccount = new javax.swing.JTabbedPane();
        jpASEdit = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jpASAddDelete = new javax.swing.JPanel();
        jpASViewPrivilege = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        listVPImportType = new javax.swing.JList();
        jScrollPane3 = new javax.swing.JScrollPane();
        listVPExportType = new javax.swing.JList();
        jCheckBoxVPBorrow = new javax.swing.JCheckBox();
        jCheckBoxVPLend = new javax.swing.JCheckBox();
        cboxViewPrivilegeUser = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jpASSetPrivilege = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jpPrivilegeImport = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        listPrivilegeImport = new javax.swing.JList();
        jpPrivilegeExport = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        listPrivilegeExport = new javax.swing.JList();
        cboxPrivilegeFrom = new javax.swing.JComboBox();
        cboxPrivilegeTo = new javax.swing.JComboBox();
        btnPrivilegeSet = new javax.swing.JButton();
        jCheckBoxSPBorrow = new javax.swing.JCheckBox();
        jCheckBoxSPLend = new javax.swing.JCheckBox();
        layerImportExport = new javax.swing.JLayeredPane();
        jDesktopPane2 = new javax.swing.JDesktopPane();
        jpImportExport = new javax.swing.JPanel();
        btnAdd = new javax.swing.JButton();
        txtValue = new javax.swing.JTextField();
        btnUpdate = new javax.swing.JButton();
        btnDelete = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tbImportExport = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtNote = new javax.swing.JTextField();
        btnView = new javax.swing.JButton();
        cboxIEUser = new javax.swing.JComboBox();
        jCheckBoxAddAsUserSelected = new javax.swing.JCheckBox();
        txtIEStatus = new javax.swing.JTextField();
        jdcIEDate = new com.toedter.calendar.JDateChooser();
        btnImportExportImage = new javax.swing.JButton();
        txtIEImageURL = new javax.swing.JTextField();
        cboxIEType = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jCheckBoxIE = new javax.swing.JCheckBox();
        layerBorrowLend = new javax.swing.JLayeredPane();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jpBorrowLend = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tbBorrowLend = new javax.swing.JTable();
        jButton8 = new javax.swing.JButton();
        cboxBL = new javax.swing.JComboBox();
        cboxType = new javax.swing.JComboBox();
        txtValue2 = new javax.swing.JTextField();
        txtRate = new javax.swing.JTextField();
        txtDate2 = new javax.swing.JTextField();
        txtExpiry = new javax.swing.JTextField();
        txtPartner = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jButton9 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        txtStatus = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();

        jMenu4.setText("File");
        jMenu4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu4ActionPerformed(evt);
            }
        });

        jMenuItem3.setText("jMenuItem3");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem3);

        jMenuBar2.add(jMenu4);

        jMenu5.setText("Edit");
        jMenuBar2.add(jMenu5);

        jMenu3.setText("jMenu3");

        jInternalFrame1.setVisible(true);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 317, Short.MAX_VALUE)
        );

        jButton1.setText("Set Image");

        javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
        jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
        jInternalFrame1Layout.setHorizontalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(364, Short.MAX_VALUE))
            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jInternalFrame1Layout.setVerticalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 30, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(27, 27, 27))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(80, 180, 200));
        setMinimumSize(new java.awt.Dimension(1024, 590));
        setPreferredSize(new java.awt.Dimension(1024, 590));
        setResizable(false);
        setType(java.awt.Window.Type.POPUP);

        layerMenu.setBackground(new java.awt.Color(80, 180, 200));
        layerMenu.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(150, 210, 222), 1, true));
        layerMenu.setForeground(new java.awt.Color(80, 180, 200));
        layerMenu.setMinimumSize(new java.awt.Dimension(225, 576));

        jDesktopPane3.setBackground(new java.awt.Color(80, 180, 200));
        jDesktopPane3.setBorder(new javax.swing.border.MatteBorder(null));
        jDesktopPane3.setMinimumSize(new java.awt.Dimension(225, 576));
        jDesktopPane3.setOpaque(false);

        jpMain.setBackground(new java.awt.Color(80, 180, 200));
        jpMain.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Quản lý chi tiêu", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BELOW_TOP, new java.awt.Font("Times New Roman", 1, 24), new java.awt.Color(255, 255, 0))); // NOI18N
        jpMain.setForeground(new java.awt.Color(80, 180, 200));
        jpMain.setMaximumSize(new java.awt.Dimension(1024, 576));
        jpMain.setMinimumSize(new java.awt.Dimension(225, 576));
        jpMain.setPreferredSize(new java.awt.Dimension(225, 576));

        jPanel2.setBackground(new java.awt.Color(83, 153, 167));
        jPanel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(150, 210, 222), 4, true));
        jPanel2.setPreferredSize(new java.awt.Dimension(212, 200));

        btnAddImportExport.setBackground(new java.awt.Color(105, 140, 147));
        btnAddImportExport.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
        btnAddImportExport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/tag.png"))); // NOI18N
        btnAddImportExport.setText("Budget");
        btnAddImportExport.setPreferredSize(new java.awt.Dimension(200, 40));
        btnAddImportExport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddImportExportActionPerformed(evt);
            }
        });

        jButton3.setBackground(new java.awt.Color(105, 140, 147));
        jButton3.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/graph.png"))); // NOI18N
        jButton3.setText("Report");
        jButton3.setPreferredSize(new java.awt.Dimension(200, 40));
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton2.setBackground(new java.awt.Color(105, 140, 147));
        jButton2.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/user.png"))); // NOI18N
        jButton2.setText("Account");
        jButton2.setPreferredSize(new java.awt.Dimension(200, 40));
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnAddImportExport, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnAddImportExport, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(4, 4, 4)
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 51, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jpMainLayout = new javax.swing.GroupLayout(jpMain);
        jpMain.setLayout(jpMainLayout);
        jpMainLayout.setHorizontalGroup(
            jpMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpMainLayout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE)
                .addContainerGap())
        );
        jpMainLayout.setVerticalGroup(
            jpMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpMainLayout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(308, Short.MAX_VALUE))
        );

        jDesktopPane3.add(jpMain);
        jpMain.setBounds(0, 0, 225, 576);

        layerMenu.add(jDesktopPane3);
        jDesktopPane3.setBounds(0, 0, 225, 576);
        layerMenu.setLayer(jDesktopPane3, javax.swing.JLayeredPane.MODAL_LAYER);

        layerStatistics.setBackground(new java.awt.Color(80, 180, 200));
        layerStatistics.setMinimumSize(new java.awt.Dimension(1024, 576));

        jDesktopPane4.setBackground(new java.awt.Color(80, 180, 200));
        jDesktopPane4.setMinimumSize(new java.awt.Dimension(800, 540));
        jDesktopPane4.setName(""); // NOI18N
        jDesktopPane4.setOpaque(false);

        jpThongKe.setBackground(new java.awt.Color(150, 210, 222));
        jpThongKe.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(80, 180, 200), 4, true));
        jpThongKe.setMinimumSize(new java.awt.Dimension(795, 540));
        jpThongKe.setPreferredSize(new java.awt.Dimension(795, 540));

        jdcEndDay.setBackground(new java.awt.Color(255, 0, 51));
        jdcEndDay.setDateFormatString("yyyy/MM/dd");
        jdcEndDay.setIcon(new ImageIcon("src/image/main/plus.png"));
        jdcEndDay.setPreferredSize(new java.awt.Dimension(200, 40));

        jLabel27.setText("Từ Ngày");

        jLabel28.setText("Đến Ngày");

        jLabel29.setText("Phân Nhóm");

        jLabel30.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/people.png"))); // NOI18N
        jLabel30.setText("Thành Viên");
        jLabel30.setMinimumSize(new java.awt.Dimension(40, 40));
        jLabel30.setPreferredSize(new java.awt.Dimension(40, 40));

        cboxStatisticsType.setMaximumSize(new java.awt.Dimension(200, 40));
        cboxStatisticsType.setMinimumSize(new java.awt.Dimension(200, 40));
        cboxStatisticsType.setPreferredSize(new java.awt.Dimension(200, 40));
        cboxStatisticsType.setRenderer(new ComboxRender("src/image/importing/",0));
        cboxStatisticsType.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                cboxStatisticsTypePopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
        });
        cboxStatisticsType.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cboxStatisticsTypeItemStateChanged(evt);
            }
        });
        cboxStatisticsType.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cboxStatisticsTypeActionPerformed(evt);
            }
        });

        cboxStatisticsUser.setMinimumSize(new java.awt.Dimension(200, 40));
        cboxStatisticsUser.setPreferredSize(new java.awt.Dimension(200, 40));
        cboxStatisticsUser.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                cboxStatisticsUserPopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
        });
        cboxStatisticsUser.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cboxStatisticsUserItemStateChanged(evt);
            }
        });

        btThucHien.setText("View");
        btThucHien.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btThucHienActionPerformed(evt);
            }
        });

        tbBangThongKe.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4", "Title 5"
            }
        ));
        jScrollPane9.setViewportView(tbBangThongKe);

        rbtThuNhap.setSelected(true);
        rbtThuNhap.setText("Thống kế thu nhập");
        rbtThuNhap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtThuNhapActionPerformed(evt);
            }
        });

        rbtChiTieu.setText("Thống kê chi tiêu");
        rbtChiTieu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtChiTieuActionPerformed(evt);
            }
        });

        lbTong.setText("Tổng Thu Nhập: ");

        jdcStartDay.setDateFormatString("yyyy/MM/dd");
        jdcStartDay.setIcon(new ImageIcon(getClass().getResource("/image/main/calendar.png")));
        jdcStartDay.setPreferredSize(new java.awt.Dimension(200, 40));

        btCharThu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/Line Chart.png"))); // NOI18N
        btCharThu.setMinimumSize(new java.awt.Dimension(40, 40));
        btCharThu.setPreferredSize(new java.awt.Dimension(40, 40));
        btCharThu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCharThuActionPerformed(evt);
            }
        });

        jCheckBox1.setSelected(true);
        jCheckBox1.setText("Importing");
        jCheckBox1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/exporting.png"))); // NOI18N
        jCheckBox1.setMaximumSize(new java.awt.Dimension(200, 40));
        jCheckBox1.setMinimumSize(new java.awt.Dimension(200, 40));
        jCheckBox1.setPreferredSize(new java.awt.Dimension(200, 40));
        jCheckBox1.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/importing.png"))); // NOI18N
        jCheckBox1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jCheckBox1MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jpThongKeLayout = new javax.swing.GroupLayout(jpThongKe);
        jpThongKe.setLayout(jpThongKeLayout);
        jpThongKeLayout.setHorizontalGroup(
            jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpThongKeLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(lbTong)
                .addGap(337, 337, 337))
            .addGroup(jpThongKeLayout.createSequentialGroup()
                .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpThongKeLayout.createSequentialGroup()
                        .addGap(313, 313, 313)
                        .addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpThongKeLayout.createSequentialGroup()
                            .addGap(49, 49, 49)
                            .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(rbtThuNhap)
                                .addComponent(rbtChiTieu)
                                .addComponent(jLabel29)
                                .addComponent(btCharThu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jpThongKeLayout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jdcStartDay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel28)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jdcEndDay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jpThongKeLayout.createSequentialGroup()
                                    .addGap(116, 116, 116)
                                    .addComponent(btThucHien, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jpThongKeLayout.createSequentialGroup()
                                    .addGap(116, 116, 116)
                                    .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(cboxStatisticsType, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(cboxStatisticsUser, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addGap(18, 18, 18)
                                    .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpThongKeLayout.createSequentialGroup()
                            .addGap(40, 40, 40)
                            .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 617, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(130, Short.MAX_VALUE))
        );
        jpThongKeLayout.setVerticalGroup(
            jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpThongKeLayout.createSequentialGroup()
                .addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpThongKeLayout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpThongKeLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jdcStartDay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jdcEndDay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpThongKeLayout.createSequentialGroup()
                                .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(11, 11, 11)))))
                .addGap(18, 18, 18)
                .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cboxStatisticsType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpThongKeLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jpThongKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboxStatisticsUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btThucHien))
                    .addGroup(jpThongKeLayout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addComponent(btCharThu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(rbtThuNhap)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(rbtChiTieu)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(90, 90, 90)
                .addComponent(lbTong))
        );

        jDesktopPane4.add(jpThongKe);
        jpThongKe.setBounds(0, 0, 795, 540);

        layerStatistics.add(jDesktopPane4);
        jDesktopPane4.setBounds(225, 0, 800, 540);
        layerStatistics.setLayer(jDesktopPane4, javax.swing.JLayeredPane.POPUP_LAYER);

        layerAccountSettings.setBackground(new java.awt.Color(80, 180, 200));
        layerAccountSettings.setMinimumSize(new java.awt.Dimension(1024, 576));

        dpAccountSettings.setMinimumSize(new java.awt.Dimension(790, 540));

        jpAccount.setBackground(new java.awt.Color(150, 210, 222));
        jpAccount.setMinimumSize(new java.awt.Dimension(790, 540));
        jpAccount.setName(""); // NOI18N
        jpAccount.setPreferredSize(new java.awt.Dimension(790, 540));

        jtpAccount.setTabPlacement(javax.swing.JTabbedPane.LEFT);

        jpASEdit.setOpaque(false);
        jpASEdit.setPreferredSize(new java.awt.Dimension(790, 790));

        jLabel10.setText("User Name");

        jLabel11.setText("PassWord");

        jLabel12.setText("Address");

        jLabel13.setText("jLabel13");

        jLabel14.setText("jLabel14");

        javax.swing.GroupLayout jpASEditLayout = new javax.swing.GroupLayout(jpASEdit);
        jpASEdit.setLayout(jpASEditLayout);
        jpASEditLayout.setHorizontalGroup(
            jpASEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpASEditLayout.createSequentialGroup()
                .addGap(52, 52, 52)
                .addGroup(jpASEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel14)
                    .addComponent(jLabel11)
                    .addComponent(jLabel10)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13))
                .addContainerGap(399, Short.MAX_VALUE))
        );
        jpASEditLayout.setVerticalGroup(
            jpASEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpASEditLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(jLabel10)
                .addGap(20, 20, 20)
                .addComponent(jLabel11)
                .addGap(18, 18, 18)
                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(jLabel13)
                .addGap(18, 18, 18)
                .addComponent(jLabel14)
                .addContainerGap(431, Short.MAX_VALUE))
        );

        jtpAccount.addTab("Edit your account", jpASEdit);

        javax.swing.GroupLayout jpASAddDeleteLayout = new javax.swing.GroupLayout(jpASAddDelete);
        jpASAddDelete.setLayout(jpASAddDeleteLayout);
        jpASAddDeleteLayout.setHorizontalGroup(
            jpASAddDeleteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 503, Short.MAX_VALUE)
        );
        jpASAddDeleteLayout.setVerticalGroup(
            jpASAddDeleteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 603, Short.MAX_VALUE)
        );

        jtpAccount.addTab("Add/Delete account", jpASAddDelete);

        listVPImportType.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(listVPImportType);

        listVPExportType.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane3.setViewportView(listVPExportType);

        jCheckBoxVPBorrow.setText("Borrow");
        jCheckBoxVPBorrow.setEnabled(false);
        jCheckBoxVPBorrow.setFocusable(false);
        jCheckBoxVPBorrow.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxVPBorrowActionPerformed(evt);
            }
        });

        jCheckBoxVPLend.setText("Lend");
        jCheckBoxVPLend.setEnabled(false);

        cboxViewPrivilegeUser.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None" }));
        cboxViewPrivilegeUser.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cboxViewPrivilegeUserItemStateChanged(evt);
            }
        });

        jLabel4.setText("On");

        javax.swing.GroupLayout jpASViewPrivilegeLayout = new javax.swing.GroupLayout(jpASViewPrivilege);
        jpASViewPrivilege.setLayout(jpASViewPrivilegeLayout);
        jpASViewPrivilegeLayout.setHorizontalGroup(
            jpASViewPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpASViewPrivilegeLayout.createSequentialGroup()
                .addGroup(jpASViewPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpASViewPrivilegeLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jpASViewPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jCheckBoxVPLend, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jCheckBoxVPBorrow)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpASViewPrivilegeLayout.createSequentialGroup()
                        .addGap(41, 41, 41)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(29, 29, 29)
                .addGroup(jpASViewPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpASViewPrivilegeLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(39, 39, 39)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(cboxViewPrivilegeUser, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(144, Short.MAX_VALUE))
        );
        jpASViewPrivilegeLayout.setVerticalGroup(
            jpASViewPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpASViewPrivilegeLayout.createSequentialGroup()
                .addGap(67, 67, 67)
                .addGroup(jpASViewPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cboxViewPrivilegeUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jpASViewPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpASViewPrivilegeLayout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addComponent(jCheckBoxVPBorrow)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jCheckBoxVPLend))
                    .addGroup(jpASViewPrivilegeLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jpASViewPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(368, Short.MAX_VALUE))
        );

        jtpAccount.addTab("View Privilege", jpASViewPrivilege);

        jLabel15.setText("From");

        jLabel16.setText("To");

        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);

        listPrivilegeImport.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane5.setViewportView(listPrivilegeImport);

        javax.swing.GroupLayout jpPrivilegeImportLayout = new javax.swing.GroupLayout(jpPrivilegeImport);
        jpPrivilegeImport.setLayout(jpPrivilegeImportLayout);
        jpPrivilegeImportLayout.setHorizontalGroup(
            jpPrivilegeImportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpPrivilegeImportLayout.createSequentialGroup()
                .addGap(65, 65, 65)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(140, Short.MAX_VALUE))
        );
        jpPrivilegeImportLayout.setVerticalGroup(
            jpPrivilegeImportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpPrivilegeImportLayout.createSequentialGroup()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(60, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Import", jpPrivilegeImport);

        listPrivilegeExport.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane6.setViewportView(listPrivilegeExport);

        javax.swing.GroupLayout jpPrivilegeExportLayout = new javax.swing.GroupLayout(jpPrivilegeExport);
        jpPrivilegeExport.setLayout(jpPrivilegeExportLayout);
        jpPrivilegeExportLayout.setHorizontalGroup(
            jpPrivilegeExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpPrivilegeExportLayout.createSequentialGroup()
                .addGap(73, 73, 73)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(127, Short.MAX_VALUE))
        );
        jpPrivilegeExportLayout.setVerticalGroup(
            jpPrivilegeExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpPrivilegeExportLayout.createSequentialGroup()
                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 10, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Export", jpPrivilegeExport);

        btnPrivilegeSet.setText("Set");
        btnPrivilegeSet.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrivilegeSetActionPerformed(evt);
            }
        });

        jCheckBoxSPBorrow.setText("Borrow");

        jCheckBoxSPLend.setText("Lend");

        javax.swing.GroupLayout jpASSetPrivilegeLayout = new javax.swing.GroupLayout(jpASSetPrivilege);
        jpASSetPrivilege.setLayout(jpASSetPrivilegeLayout);
        jpASSetPrivilegeLayout.setHorizontalGroup(
            jpASSetPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpASSetPrivilegeLayout.createSequentialGroup()
                .addGroup(jpASSetPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpASSetPrivilegeLayout.createSequentialGroup()
                        .addGap(41, 41, 41)
                        .addGroup(jpASSetPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jpASSetPrivilegeLayout.createSequentialGroup()
                                .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jpASSetPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jpASSetPrivilegeLayout.createSequentialGroup()
                                        .addComponent(jCheckBoxSPBorrow)
                                        .addGap(68, 68, 68)
                                        .addComponent(jCheckBoxSPLend))
                                    .addGroup(jpASSetPrivilegeLayout.createSequentialGroup()
                                        .addComponent(cboxPrivilegeFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(48, 48, 48)
                                        .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(cboxPrivilegeTo, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                    .addGroup(jpASSetPrivilegeLayout.createSequentialGroup()
                        .addGap(148, 148, 148)
                        .addComponent(btnPrivilegeSet, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(73, Short.MAX_VALUE))
        );
        jpASSetPrivilegeLayout.setVerticalGroup(
            jpASSetPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpASSetPrivilegeLayout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(jpASSetPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(jLabel16)
                    .addComponent(cboxPrivilegeFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cboxPrivilegeTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(35, 35, 35)
                .addGroup(jpASSetPrivilegeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCheckBoxSPBorrow)
                    .addComponent(jCheckBoxSPLend))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addComponent(btnPrivilegeSet)
                .addContainerGap(134, Short.MAX_VALUE))
        );

        jtpAccount.addTab("Set privilege", jpASSetPrivilege);

        javax.swing.GroupLayout jpAccountLayout = new javax.swing.GroupLayout(jpAccount);
        jpAccount.setLayout(jpAccountLayout);
        jpAccountLayout.setHorizontalGroup(
            jpAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpAccountLayout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addComponent(jtpAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 619, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(131, Short.MAX_VALUE))
        );
        jpAccountLayout.setVerticalGroup(
            jpAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpAccountLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jtpAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 608, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        dpAccountSettings.add(jpAccount);
        jpAccount.setBounds(0, 0, 790, 540);
        jpAccount.getAccessibleContext().setAccessibleName("");

        layerAccountSettings.add(dpAccountSettings);
        dpAccountSettings.setBounds(225, 0, 790, 540);

        layerImportExport.setBackground(new java.awt.Color(80, 180, 200));
        layerImportExport.setMinimumSize(new java.awt.Dimension(1024, 576));

        jDesktopPane2.setBackground(new java.awt.Color(80, 180, 200));
        jDesktopPane2.setMinimumSize(new java.awt.Dimension(1024, 576));

        jpImportExport.setBackground(new java.awt.Color(150, 210, 222));
        jpImportExport.setMinimumSize(new java.awt.Dimension(790, 540));
        jpImportExport.setPreferredSize(new java.awt.Dimension(790, 540));

        btnAdd.setBackground(new java.awt.Color(115, 170, 187));
        btnAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/plus.png"))); // NOI18N
        btnAdd.setBorder(null);
        btnAdd.setBorderPainted(false);
        btnAdd.setFocusPainted(false);
        btnAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddActionPerformed(evt);
            }
        });

        txtValue.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        txtValue.setPreferredSize(new java.awt.Dimension(200, 40));

        btnUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/refresh.png"))); // NOI18N
        btnUpdate.setPreferredSize(new java.awt.Dimension(40, 40));
        btnUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateActionPerformed(evt);
            }
        });

        btnDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/delete_64.png"))); // NOI18N
        btnDelete.setPreferredSize(new java.awt.Dimension(40, 40));
        btnDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteActionPerformed(evt);
            }
        });

        tbImportExport.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Id", "User", "Date", "Type", "Value", "Note"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tbImportExport.setPreferredSize(new java.awt.Dimension(740, 200));
        tbImportExport.setRowHeight(25);
        tbImportExport.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbImportExportMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tbImportExport);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/Dollar-256.png"))); // NOI18N

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/calendar.png"))); // NOI18N

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/survey.png"))); // NOI18N

        txtNote.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        txtNote.setMinimumSize(new java.awt.Dimension(200, 80));
        txtNote.setPreferredSize(new java.awt.Dimension(200, 80));

        btnView.setText("View");
        btnView.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnViewActionPerformed(evt);
            }
        });

        cboxIEUser.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        cboxIEUser.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "No User" }));
        cboxIEUser.setOpaque(false);

        jCheckBoxAddAsUserSelected.setText("Add as User Selected");

        jdcIEDate.setDateFormatString("yyyy/MM/dd");
        jdcIEDate.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        jdcIEDate.setIcon(null);
        jdcIEDate.setOpaque(false);
        jdcIEDate.setPreferredSize(new java.awt.Dimension(200, 40));

        btnImportExportImage.setBackground(java.awt.SystemColor.controlLtHighlight);
        btnImportExportImage.setMaximumSize(new java.awt.Dimension(400, 300));
        btnImportExportImage.setMinimumSize(new java.awt.Dimension(400, 300));
        btnImportExportImage.setPreferredSize(new java.awt.Dimension(300, 200));
        btnImportExportImage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImportExportImageActionPerformed(evt);
            }
        });

        txtIEImageURL.setText("image URL");

        cboxIEType.setBackground(new java.awt.Color(150, 210, 222));
        cboxIEType.setEditable(true);
        cboxIEType.setFont(cboxIEType.getFont().deriveFont((float)18));
        cboxIEType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Type" }));
        cboxIEType.setMaximumSize(new java.awt.Dimension(1000, 20));
        cboxIEType.setMinimumSize(new java.awt.Dimension(200, 40));
        cboxIEType.setName(""); // NOI18N
        cboxIEType.setOpaque(false);
        cboxIEType.setPreferredSize(new java.awt.Dimension(200, 40));
        cboxIEType.setRenderer(new ComboxRender("src/image/importing/",0));
        cboxIEType.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cboxIETypeItemStateChanged(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/Picture.png"))); // NOI18N
        jLabel5.setText("Image");
        jLabel5.setPreferredSize(new java.awt.Dimension(40, 40));
        jLabel5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel5MouseClicked(evt);
            }
        });

        jCheckBoxIE.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
        jCheckBoxIE.setSelected(true);
        jCheckBoxIE.setText("Importing");
        jCheckBoxIE.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/exporting.png"))); // NOI18N
        jCheckBoxIE.setMaximumSize(new java.awt.Dimension(200, 40));
        jCheckBoxIE.setMinimumSize(new java.awt.Dimension(200, 40));
        jCheckBoxIE.setOpaque(false);
        jCheckBoxIE.setPreferredSize(new java.awt.Dimension(200, 40));
        jCheckBoxIE.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main/importing.png"))); // NOI18N
        jCheckBoxIE.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jCheckBoxIEMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jpImportExportLayout = new javax.swing.GroupLayout(jpImportExport);
        jpImportExport.setLayout(jpImportExportLayout);
        jpImportExportLayout.setHorizontalGroup(
            jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpImportExportLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpImportExportLayout.createSequentialGroup()
                        .addComponent(jCheckBoxAddAsUserSelected)
                        .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpImportExportLayout.createSequentialGroup()
                                .addGap(279, 279, 279)
                                .addComponent(txtIEImageURL, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpImportExportLayout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(btnView)
                                .addGap(188, 188, 188)
                                .addComponent(txtIEStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jpImportExportLayout.createSequentialGroup()
                        .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpImportExportLayout.createSequentialGroup()
                                .addGap(9, 9, 9)
                                .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(btnAdd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(btnDelete, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(cboxIEUser, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtNote, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtValue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jdcIEDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cboxIEType, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpImportExportLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3))
                                .addGap(18, 18, 18)
                                .addComponent(btnImportExportImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpImportExportLayout.createSequentialGroup()
                                .addGap(165, 165, 165)
                                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jpImportExportLayout.createSequentialGroup()
                        .addGap(274, 274, 274)
                        .addComponent(jCheckBoxIE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpImportExportLayout.createSequentialGroup()
                .addContainerGap(45, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 700, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(45, Short.MAX_VALUE))
        );
        jpImportExportLayout.setVerticalGroup(
            jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpImportExportLayout.createSequentialGroup()
                .addComponent(jCheckBoxIE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jpImportExportLayout.createSequentialGroup()
                        .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpImportExportLayout.createSequentialGroup()
                                .addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnDelete, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpImportExportLayout.createSequentialGroup()
                                .addComponent(cboxIEType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txtValue, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel1))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jdcIEDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel2))))
                        .addGap(7, 7, 7)
                        .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtNote, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(cboxIEUser, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpImportExportLayout.createSequentialGroup()
                                .addGap(21, 21, 21)
                                .addComponent(jLabel3))))
                    .addGroup(jpImportExportLayout.createSequentialGroup()
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnImportExportImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(4, 4, 4)))
                .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpImportExportLayout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addGroup(jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpImportExportLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jCheckBoxAddAsUserSelected)
                                .addComponent(btnView))
                            .addComponent(txtIEStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(txtIEImageURL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12))
        );

        jDesktopPane2.add(jpImportExport);
        jpImportExport.setBounds(0, 0, 790, 540);

        layerImportExport.add(jDesktopPane2);
        jDesktopPane2.setBounds(225, 0, 1024, 576);

        layerBorrowLend.setBackground(new java.awt.Color(80, 180, 200));
        layerBorrowLend.setMinimumSize(new java.awt.Dimension(1024, 576));

        jDesktopPane1.setBackground(new java.awt.Color(80, 180, 200));
        jDesktopPane1.setPreferredSize(new java.awt.Dimension(790, 540));

        jpBorrowLend.setMinimumSize(new java.awt.Dimension(790, 540));
        jpBorrowLend.setPreferredSize(new java.awt.Dimension(790, 540));

        tbBorrowLend.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Id", "User", "Value", "Rate", "Date Borrow/Lend", "Expire Date", "Info Partner", "Type"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true, true, true, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tbBorrowLend.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbBorrowLendMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(tbBorrowLend);

        jButton8.setText("View");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        cboxBL.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Borrow", "Lend" }));
        cboxBL.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cboxBLItemStateChanged(evt);
            }
        });
        cboxBL.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cboxBLActionPerformed(evt);
            }
        });

        cboxType.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cboxTypeActionPerformed(evt);
            }
        });

        txtValue2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtValue2ActionPerformed(evt);
            }
        });

        txtRate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtRateActionPerformed(evt);
            }
        });

        txtDate2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtDate2ActionPerformed(evt);
            }
        });

        txtExpiry.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtExpiryActionPerformed(evt);
            }
        });

        txtPartner.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtPartnerActionPerformed(evt);
            }
        });

        jLabel21.setText("Partner");

        jLabel22.setText("Expire Date");

        jLabel23.setText("Date ");

        jLabel24.setText("Rate");

        jLabel25.setText("Value");

        jLabel26.setText("Type");

        jButton9.setText("Add");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        jButton10.setText("Update");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        jButton11.setText("Delete");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        txtStatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtStatusActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpBorrowLendLayout = new javax.swing.GroupLayout(jpBorrowLend);
        jpBorrowLend.setLayout(jpBorrowLendLayout);
        jpBorrowLendLayout.setHorizontalGroup(
            jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpBorrowLendLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpBorrowLendLayout.createSequentialGroup()
                        .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(99, 99, 99)
                        .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jpBorrowLendLayout.createSequentialGroup()
                        .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpBorrowLendLayout.createSequentialGroup()
                                .addComponent(cboxBL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(34, 34, 34)
                                .addComponent(jLabel26))
                            .addComponent(cboxType, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(47, 47, 47)
                        .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel25)
                            .addComponent(txtValue2, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpBorrowLendLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(257, 257, 257))
                            .addGroup(jpBorrowLendLayout.createSequentialGroup()
                                .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtRate, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jpBorrowLendLayout.createSequentialGroup()
                                        .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(txtDate2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel23))
                                        .addGap(18, 18, 18)
                                        .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel22)
                                            .addComponent(txtExpiry, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(18, 18, 18)
                                        .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(txtPartner, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(jpBorrowLendLayout.createSequentialGroup()
                                        .addGap(88, 88, 88)
                                        .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addContainerGap(194, Short.MAX_VALUE))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpBorrowLendLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(txtStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(62, 62, 62))
                    .addComponent(jScrollPane4)))
        );
        jpBorrowLendLayout.setVerticalGroup(
            jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpBorrowLendLayout.createSequentialGroup()
                .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpBorrowLendLayout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel21)
                            .addComponent(jLabel22)
                            .addComponent(jLabel23)
                            .addComponent(jLabel24)
                            .addComponent(jLabel25)
                            .addComponent(jLabel26))
                        .addGap(18, 18, 18))
                    .addGroup(jpBorrowLendLayout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(cboxBL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtValue2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtRate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtDate2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtExpiry, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtPartner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(cboxType, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(35, 35, 35)
                .addGroup(jpBorrowLendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton9)
                    .addComponent(jButton10)
                    .addComponent(jButton11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(256, 256, 256))
        );

        jDesktopPane1.add(jpBorrowLend);
        jpBorrowLend.setBounds(0, 0, 790, 540);

        layerBorrowLend.add(jDesktopPane1);
        jDesktopPane1.setBounds(225, 0, 790, 540);

        jMenu1.setText("Option");

        jMenuItem1.setText("Account Settings");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Menu");
        jMenu2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu2ActionPerformed(evt);
            }
        });

        jMenuItem2.setText("Main Menu");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(layerImportExport, javax.swing.GroupLayout.PREFERRED_SIZE, 1024, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(layerMenu, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(layerBorrowLend, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(layerAccountSettings, javax.swing.GroupLayout.PREFERRED_SIZE, 1054, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(layerStatistics, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(layerImportExport, javax.swing.GroupLayout.PREFERRED_SIZE, 576, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(layerMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(layerBorrowLend, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(layerAccountSettings, javax.swing.GroupLayout.DEFAULT_SIZE, 576, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(layerStatistics, javax.swing.GroupLayout.DEFAULT_SIZE, 576, Short.MAX_VALUE))
        );

        getAccessibleContext().setAccessibleDescription("");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        //layerMenu.setVisible(false);

        layerAccountSettings.setVisible(false);
        layerBorrowLend.setVisible(false);
        layerImportExport.setVisible(false);       
        layerStatistics.setVisible(true);
       // jpThongKe.setVisible(true);
        
    }//GEN-LAST:event_jButton3ActionPerformed
    
    private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
      
            InfoImportExport infoIE = new InfoImportExport(((JTextField)jdcIEDate.getDateEditor().getUiComponent()).getText(),Integer.parseInt(txtValue.getText()),txtNote.getText(),txtIEImageURL.getText(),user.id,cboxIEType.getSelectedIndex(),jCheckBoxIE.isSelected());
            if(user.id==1){
                    if(jCheckBoxAddAsUserSelected.isSelected()) infoIE.user_id= user.getUserId((String)cboxIEUser.getSelectedItem());
                    if(importExport.insert(infoIE)) txtIEStatus.setText("Add thanh cong");
                    else txtIEStatus.setText("Add that bai");
            }
            else if(user.id==user.getUserId((String)cboxIEUser.getSelectedItem())){                                
                    if(importExport.insert(infoIE)) txtIEStatus.setText("Add thanh cong");
                    else txtIEStatus.setText("Add that bai");
            }
            
            //Luu hinh anh vao thu muc rieng
        File image = new File(txtIEImageURL.getText());
        try {
            BufferedImage bufferImg = Thumbnails.of(ImageIO.read(image)).size(640, 480).asBufferedImage();        
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            ImageIO.write(bufferImg, "jpg", os);
            InputStream ip = new ByteArrayInputStream(os.toByteArray());
            String outputFile = "G:\\Project I\\Image\\"+image.getName();
            txtIEImageURL.setText(image.getName());
            FileOutputStream fos = new FileOutputStream( outputFile);
            int c;   
            while ((c = ip.read()) != -1) {
                fos.write(c);       
            }        
            ip.close();
            fos.close();
        
            
        } catch (IOException ex) {
            System.out.println("error");
        }
    }//GEN-LAST:event_btnAddActionPerformed

    private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
        if(tbImportExport.getSelectedRow()!= -1){
            int row = tbImportExport.getSelectedRow();
            InfoImportExport infoIE = new InfoImportExport(((JTextField)jdcIEDate.getDateEditor().getUiComponent()).getText(),Integer.parseInt(txtValue.getText()), txtNote.getText(),txtIEImageURL.getText(),user.getUserId(tbImportExport.getValueAt(row, 1).toString()), cboxIEType.getSelectedIndex(), jCheckBoxIE.isSelected());  
            if(user.id==1 || user.id == user.getUserId((String)cboxIEUser.getSelectedItem())){                   
                if(importExport.update((int)tbImportExport.getValueAt(tbImportExport.getSelectedRow(), 0), infoIE)) txtIEStatus.setText("Update thanh cong");
                else txtIEStatus.setText("Update that bai"); 
            }
            else txtIEStatus.setText("Khong thuc hien duoc chuc nang nay");
        }
         else txtIEStatus.setText("Chua chon hang can Update");
    }//GEN-LAST:event_btnUpdateActionPerformed

    private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
        if(tbImportExport.getSelectedRow()!= -1){
            if(user.id==1 || user.id==user.getUserId((String)cboxIEUser.getSelectedItem())){
                if(importExport.delete((int)tbImportExport.getValueAt(tbImportExport.getSelectedRow(), 0), jCheckBoxIE.isSelected())) txtIEStatus.setText("Delete thanh cong");
                else txtIEStatus.setText("Delete that bai");    
            }
            else txtIEStatus.setText("Khong thuc hien duoc chuc nang nay");
        }
        else txtIEStatus.setText("Chua chon hang can Delete");
    }//GEN-LAST:event_btnDeleteActionPerformed

    private void btnViewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewActionPerformed

        ResultSet rs = importExport.getData(user.id, user.getUserId((String)cboxIEUser.getSelectedItem()),cboxIEType.getSelectedIndex(), jCheckBoxIE.isSelected());
        tbImportExport.setModel(new rsTableModel(rs));
    }//GEN-LAST:event_btnViewActionPerformed

    private void tbImportExportMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbImportExportMouseClicked
       if(evt.getButton()==MouseEvent.BUTTON1){
           int row = tbImportExport.getSelectedRow();
           txtValue.setText(tbImportExport.getValueAt(row, 4).toString());
           ((JTextField)jdcIEDate.getDateEditor().getUiComponent()).setText(tbImportExport.getValueAt(row, 2).toString());
           cboxIEType.setSelectedItem(tbImportExport.getValueAt(row, 3).toString());
           
           txtIEImageURL.setText((String)tbImportExport.getValueAt(row, 6));
           btnImportExportImage.setIcon(new ImageIcon("G:\\Project I\\Image\\"+txtIEImageURL.getText()));
           try{
               txtNote.setText(tbImportExport.getValueAt(row, 5).toString());
           }catch(Exception ex){
               txtNote.setText("");
           }
           
       }
       
    }//GEN-LAST:event_tbImportExportMouseClicked

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
         
        layerStatistics.setVisible(true);
        layerAccountSettings.setVisible(false);
        layerImportExport.setVisible(false);
        layerBorrowLend.setVisible(false);
        //layerMenu.setVisible(false);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void btnAddImportExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddImportExportActionPerformed
        //layerMenu.setVisible(false);
        layerImportExport.setVisible(true);
        layerStatistics.setVisible(false);
        layerAccountSettings.setVisible(false);
        
    }//GEN-LAST:event_btnAddImportExportActionPerformed

    private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed

    }//GEN-LAST:event_jMenu2ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        layerAccountSettings.setVisible(true);
        layerStatistics.setVisible(false);
        layerImportExport.setVisible(false);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        layerBorrowLend.setVisible(false);
        layerImportExport.setVisible(false);
        layerAccountSettings.setVisible(false);
        layerStatistics.setVisible(false);
        layerMenu.setVisible(true);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void tbBorrowLendMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbBorrowLendMouseClicked
        // TODO add your handling code here:
        int row = tbBorrowLend.getSelectedRow();
        if (row ==-1) return;
        txtValue2.setText(tbBorrowLend.getValueAt(row, 2).toString());
        txtRate.setText(tbBorrowLend.getValueAt(row, 3).toString());
        txtDate2.setText(tbBorrowLend.getValueAt(row, 4).toString());
        txtExpiry.setText(tbBorrowLend.getValueAt(row, 5).toString());
        txtPartner.setText(tbBorrowLend.getValueAt(row, 6).toString());
        int type_id=(Integer)tbBorrowLend.getValueAt(row, 7);
        ResultSet kq=null;
        try
        {
            kq=Database.stm.executeQuery("select * from borrow_lend_type "
                + "where id = "+type_id+";");
            if (kq.next())
            cboxType.setSelectedItem(kq.getInt(1)+" : Cycle "+kq.getInt(2)+" Type "+kq.getInt(3));
        }
        catch(Exception e)
        {}

    }//GEN-LAST:event_tbBorrowLendMouseClicked

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        // TODO add your handling code here:
        tbBorrowLend.removeAll();

        if (cboxBL.getSelectedIndex()==0)
        return;
        try
        {
            ResultSet kq=null;
            String lenh="";
            if (cboxBL.getSelectedIndex()==1)
            lenh="select id, user_id, value, interestRate, "
            + "dateBorrow, expiryDate, infoLender, "
            + "borrow_lend_type_id"
            + " from borrowing ";
            else
            lenh="select id, user_id, value, interestRate, "
            + "dateLend, expiryDate, infoBorrower, "
            + "borrow_lend_type_id "
            + "from lending ";
            lenh+="where user_id="+user.id+";";
            kq=Database.stm.executeQuery(lenh);

            tbBorrowLend.setModel( new rsTableModel(kq));

        }
        catch(Exception e)
        {
            System.out.println("loi");
        }

    }//GEN-LAST:event_jButton8ActionPerformed

    private void cboxBLItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboxBLItemStateChanged
        // TODO add your handling code here:
        cboxType.removeAllItems();
        cboxType.addItem("All");
        InfoBorrowLend infoBL=new InfoBorrowLend();

        ResultSet kq=null;
        try
        {
            kq=Database.stm.executeQuery("select * from borrow_lend_type;");
            while (kq.next())
            {

                cboxType.addItem(kq.getInt(1)+" : Cycle "+kq.getInt(2)+" Type "+kq.getInt(3));
            }
        }
        catch(Exception e)
        {
            System.out.println("loi");
        }
    }//GEN-LAST:event_cboxBLItemStateChanged

    private void cboxBLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboxBLActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cboxBLActionPerformed

    private void cboxTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboxTypeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cboxTypeActionPerformed

    private void txtValue2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtValue2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtValue2ActionPerformed

    private void txtRateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtRateActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtRateActionPerformed

    private void txtDate2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDate2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtDate2ActionPerformed

    private void txtExpiryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtExpiryActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtExpiryActionPerformed

    private void txtPartnerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPartnerActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtPartnerActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        // TODO add your handling code here:
        try
        {
            InfoBorrowLend infoBL=new InfoBorrowLend(
                Integer.parseInt(txtValue2.getText()),
                Integer.parseInt(txtRate.getText()),
                (txtDate2.getText()),
                txtExpiry.getText(),
                txtPartner.getText(),
                0,//borrow_lend_id
                user.id,
                cboxBL.getSelectedIndex()==1);
            String strtype=(String)cboxType.getSelectedItem();
            int i=0;
            while (strtype.charAt(i)!=' ')
            i++;

            infoBL.setBorrow_lend_id(Integer.parseInt(strtype.substring(0,i)));
            if (borrowLend.insert(infoBL))
            txtStatus.setText("Viec them thanh cong");
            else
            txtStatus.setText("Viec them that bai");
        }
        catch(Exception e)
        {
            txtStatus.setText("Viec them that bai");
        }
    }//GEN-LAST:event_jButton9ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        // TODO add your handling code here:
        try
        {
            InfoBorrowLend infoBL=new InfoBorrowLend(
                Integer.parseInt(txtValue2.getText()),
                Integer.parseInt(txtRate.getText()),
                txtDate2.getText(),
                txtExpiry.getText(),
                txtPartner.getText(),
                0,//borrow_lend_id
                user.id,
                cboxBL.getSelectedIndex()==1);
            String strtype=(String)cboxType.getSelectedItem();
            int i=0;
            while (strtype.charAt(i)!=' ')
            i++;

            infoBL.setBorrow_lend_id(Integer.parseInt(strtype.substring(0,i)));
            if (borrowLend.update((int)tbBorrowLend.getValueAt(tbBorrowLend.getSelectedRow(),0),infoBL))
                txtStatus.setText("Viec cap nhat thanh cong");
            else 
                txtStatus.setText("Viec cap nhat that bai");
        }
        catch(Exception e)
        {
            txtStatus.setText("Viec cap nhat that bai");
        }

    }//GEN-LAST:event_jButton10ActionPerformed

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        // TODO add your handling code here:
        try
        {
            if(borrowLend.delete((int)tbBorrowLend.getValueAt(tbBorrowLend.getSelectedRow(),0),cboxType.getSelectedIndex()==1))
            txtStatus.setText("Viec xoa thanh cong");
            else
            txtStatus.setText("Viec xoa that bai");
        }
        catch(Exception e)
        {
            txtStatus.setText("Viec xoa that bai");
        }

    }//GEN-LAST:event_jButton11ActionPerformed

    private void txtStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtStatusActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtStatusActionPerformed
    
    private void btnPrivilegeSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrivilegeSetActionPerformed
        int fromId = user.getUserId((String)cboxPrivilegeFrom.getSelectedItem());
        int toId = user.getUserId((String)cboxPrivilegeTo.getSelectedItem());

        ArrayList<InfoPrivilege> listPrivilege = new ArrayList<InfoPrivilege>();
        
        for(int i=0 ; i < listPrivilegeImport.getModel().getSize(); i++){
            if(listPrivilegeImport.isSelectedIndex(i)) listPrivilege.add(new InfoPrivilege(fromId, toId, 1, i+1));           
        }
        
        for(int i=0;i<listPrivilegeExport.getModel().getSize();i++){
            if(listPrivilegeExport.isSelectedIndex(i)) listPrivilege.add(new InfoPrivilege(fromId, toId, 2, i+1));
        }
        
        if(jCheckBoxSPBorrow.isSelected()) listPrivilege.add(new InfoPrivilege(fromId, toId, 3, 0));
        if(jCheckBoxSPLend.isSelected()) listPrivilege.add(new InfoPrivilege(fromId, toId, 4, 0));
        
        privilege.setPrivilege(listPrivilege, fromId, toId);
        
    }//GEN-LAST:event_btnPrivilegeSetActionPerformed

    private void cboxViewPrivilegeUserItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboxViewPrivilegeUserItemStateChanged
        ArrayList<String> listType; 
        DefaultListModel<String> modelImportType = new DefaultListModel<>();
        DefaultListModel<String> modelExportType = new DefaultListModel<>();
        jCheckBoxVPBorrow.setSelected(false);
        jCheckBoxVPLend.setSelected(false);
        
        //xay dung danh sach quyen han cho import list
        listType = privilege.getPrivilegeType(user.id, user.getUserId((String)cboxViewPrivilegeUser.getSelectedItem()),1);
        for(String s:listType){
            modelImportType.addElement(s);
        }
        listVPImportType.setModel(modelImportType);
        
        //xay dung danh sach quyen han cho export list
        listType = privilege.getPrivilegeType(user.id, user.getUserId((String)cboxViewPrivilegeUser.getSelectedItem()),2);
        for(String s:listType){
            modelExportType.addElement(s);
        }
        listVPExportType.setModel(modelExportType);
        
        
        listType = privilege.getPrivilegeType(user.id, user.getUserId((String)cboxViewPrivilegeUser.getSelectedItem()),3);
        if(listType.size()>0) jCheckBoxVPBorrow.setSelected(true);
        
        listType = privilege.getPrivilegeType(user.id, user.getUserId((String)cboxViewPrivilegeUser.getSelectedItem()),4);
        if(listType.size()>0) jCheckBoxVPLend.setSelected(true);
        
    }//GEN-LAST:event_cboxViewPrivilegeUserItemStateChanged

    private void jCheckBoxVPBorrowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxVPBorrowActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jCheckBoxVPBorrowActionPerformed

    
    private void btCharThuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCharThuActionPerformed
        statisticsChartFrame.setVisible(true);             
    }//GEN-LAST:event_btCharThuActionPerformed

    private void rbtChiTieuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtChiTieuActionPerformed
        rbtThuNhap.setSelected(false);
        if (user.id != 1) {
            cboxStatisticsType.removeAllItems();
            this.cboxStatisticsUserItemStateChanged(null);
        }
        else{
            cboxStatisticsType.removeAllItems();
            cboxStatisticsType.addItem("All");
            for(String s: exportTypeList){
                cboxStatisticsType.addItem(s);
            }
        }
    }//GEN-LAST:event_rbtChiTieuActionPerformed

    private void rbtThuNhapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtThuNhapActionPerformed
        rbtChiTieu.setSelected(false);
        if (user.id != 1) {
            cboxStatisticsType.removeAllItems();
            this.cboxStatisticsUserItemStateChanged(null);
        }
        else{
            cboxStatisticsType.removeAllItems();
            cboxStatisticsType.addItem("All");
            for(String s: importTypeList){
                cboxStatisticsType.addItem(s);
            }
        }
    }//GEN-LAST:event_rbtThuNhapActionPerformed

    private void btThucHienActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btThucHienActionPerformed

        ResultSet rs = null;
        String type = "", sql1 = null, sql2 = null, thanhvien = null;
        String time = "";
        String sday = (((JTextField) jdcStartDay.getDateEditor().getUiComponent()).getText());
        String eday = (((JTextField) jdcEndDay.getDateEditor().getUiComponent()).getText());
        sql1=importExport.getStringSql(user.id, user.getUserId((String) cboxStatisticsUser.getSelectedItem()), jCheckBox1.isSelected()?importExport.getImportId((String)cboxStatisticsType.getSelectedItem()):importExport.getExportId((String)cboxStatisticsType.getSelectedItem()), jCheckBox1.isSelected(), sday, eday);
        System.out.println(sql1);
        try {
            rs = Database.stm.executeQuery(sql1);
        } catch (SQLException ex) {
            System.out.println("Error!!!");
        }
        sql2 = "select sum(value) sum from importing i ";
        sql2 += "inner join user u on i.user_id = u.id ";
        sql2 += "inner join import_type im on im.id = i.import_type_id ";
        sql2 += "where u.name = '" + (String) cboxStatisticsUser.getSelectedItem() + "' and im.type = '" + (String) cboxStatisticsType.getSelectedItem() + "'and i.date between '" + sday + "' and '" + eday + "'";

        try {

            rs = Database.stm.executeQuery(sql1);
            tbBangThongKe.setModel(new rsTableModel(rs));
            rs = Database.stm.executeQuery(sql2);
            if (rs.next()) {
                int sum = rs.getInt("sum");
                lbTong.setText("Tổng thu nhập là : " + sum);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }//GEN-LAST:event_btThucHienActionPerformed

    private void cboxStatisticsUserItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboxStatisticsUserItemStateChanged
        if (user.id != 1) {
            ArrayList<String> list = new ArrayList<>();
            list = importExport.getImportExportListWithPrivilege(user.id, user.getUserId((String) cboxStatisticsUser.getSelectedItem()), rbtThuNhap.isSelected());
            cboxStatisticsType.removeAllItems();
            cboxStatisticsType.addItem("All");
            for (String s : list) {
                cboxStatisticsType.addItem(s);
            }
            cboxStatisticsType.setSelectedIndex(0);
        }
    }//GEN-LAST:event_cboxStatisticsUserItemStateChanged

    private void cboxStatisticsUserPopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_cboxStatisticsUserPopupMenuWillBecomeInvisible

    }//GEN-LAST:event_cboxStatisticsUserPopupMenuWillBecomeInvisible

    private void cboxStatisticsTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboxStatisticsTypeItemStateChanged

    }//GEN-LAST:event_cboxStatisticsTypeItemStateChanged

    private void cboxStatisticsTypePopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_cboxStatisticsTypePopupMenuWillBecomeInvisible

    }//GEN-LAST:event_cboxStatisticsTypePopupMenuWillBecomeInvisible

    private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu4ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void btnImportExportImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImportExportImageActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnImportExportImageActionPerformed

    private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseClicked
        // TODO add your handling code here:
            String directory = "C:\\";
            FileDialog f = new FileDialog(this, "Open File", FileDialog.LOAD);
            f.setDirectory(directory);       // Set the default directory

            // Display the dialog and wait for the user's response
            f.show();
            directory = f.getDirectory();    // Remember new default directory
            String filepath = directory+f.getFile();
            File image = new File(filepath);
            txtIEImageURL.setText(f.getFile());
        try {
            BufferedImage bufferImg = Thumbnails.of(ImageIO.read(image)).size(300, 200).asBufferedImage();
            btnImportExportImage.setIcon(new ImageIcon(bufferImg));        
        } catch (IOException ex) {
            System.out.println("error");
        }
    }//GEN-LAST:event_jLabel5MouseClicked

    private void jCheckBox1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jCheckBox1MouseClicked
        // TODO add your handling code here:
        if(jCheckBox1.isSelected()){
            jCheckBox1.setText("Exporting");
            jCheckBox1.setSelected(false);
        }
        else{
            jCheckBox1.setText("Importing");
            jCheckBox1.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBox1MouseClicked

    private void cboxStatisticsTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboxStatisticsTypeActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_cboxStatisticsTypeActionPerformed

    private void jCheckBoxIEMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jCheckBoxIEMouseClicked
        // TODO add your handling code here:                      
                if(jCheckBoxIE.isSelected()){  
                    jCheckBoxIE.setText("Importing");
                    cboxIEType.removeAllItems();
                    cboxIEType.addItem("All");
                    for(String s : importTypeList){
                        cboxIEType.addItem(s);
                    }
                    cboxIEType.setRenderer(new ComboxRender("src/image/importing/",0));
                    
                }
                else {
                    //cboxIEType.setFont(cboxIEType.getFont());
                    jCheckBoxIE.setText("Exporting");
                    cboxIEType.removeAllItems();
                    cboxIEType.addItem("All");
                    for(String s : exportTypeList){
                        cboxIEType.addItem(s);
                    }
                    cboxIEType.setRenderer(new ComboxRender("src/image/exporting/",0));
                }
    }//GEN-LAST:event_jCheckBoxIEMouseClicked

    private void cboxIETypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboxIETypeItemStateChanged
        // TODO add your handling code here:    
    }//GEN-LAST:event_cboxIETypeItemStateChanged

    /**
     * @param args the command line arguments
     */
    private void initLayerAccountSettings() {
        DefaultListModel<String> modelImport = new DefaultListModel<>();

        if (user.id != 1) {
            jtpAccount.removeTabAt(3);
            jtpAccount.removeTabAt(1);
        }

        for (String s : importTypeList) {
            modelImport.addElement(s);
        }
        listPrivilegeImport.setModel(modelImport);

        DefaultListModel<String> modelExport = new DefaultListModel<>();
        for (String s : exportTypeList) {
            modelExport.addElement(s);
        }
        listPrivilegeExport.setModel(modelExport);

        DefaultListModel<String> modelUser = new DefaultListModel<>();
        for (String s : userList) {
            cboxPrivilegeFrom.addItem(s);
            cboxPrivilegeTo.addItem(s);
        }

        //thiet lap cbox ViewPrivilegeser
        for (String s : userList) {
            if (user.userName.equals(s) == false) {
                cboxViewPrivilegeUser.addItem((String) s);
            }
        }

    }
    
    private void initLayerImportExport() {
        for (String s : userList) {
            cboxIEUser.addItem(s);
        }
        if (user.id != 1) {
            jCheckBoxAddAsUserSelected.setVisible(false);
        }
    }
    

    private void initLayerStatistics() {

        for (String s : userList) {
            cboxStatisticsUser.addItem(s);
        }
        
        cboxStatisticsType.addItem("All");
        for(String s: importTypeList){
            cboxStatisticsType.addItem(s);
        }
        
        rbtThuNhap.setSelected(true);
    }


    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        Database.setState();
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Main("hien").setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btCharThu;
    private javax.swing.JButton btThucHien;
    private javax.swing.JButton btnAdd;
    private javax.swing.JButton btnAddImportExport;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnImportExportImage;
    private javax.swing.JButton btnPrivilegeSet;
    private javax.swing.JButton btnUpdate;
    private javax.swing.JButton btnView;
    private javax.swing.ButtonGroup buttonGroup;
    private javax.swing.JComboBox cboxBL;
    private javax.swing.JComboBox cboxIEType;
    private javax.swing.JComboBox cboxIEUser;
    private javax.swing.JComboBox cboxPrivilegeFrom;
    private javax.swing.JComboBox cboxPrivilegeTo;
    private javax.swing.JComboBox cboxStatisticsType;
    private javax.swing.JComboBox cboxStatisticsUser;
    private javax.swing.JComboBox cboxType;
    private javax.swing.JComboBox cboxViewPrivilegeUser;
    private javax.swing.JDesktopPane dpAccountSettings;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBoxAddAsUserSelected;
    private javax.swing.JCheckBox jCheckBoxIE;
    private javax.swing.JCheckBox jCheckBoxSPBorrow;
    private javax.swing.JCheckBox jCheckBoxSPLend;
    private javax.swing.JCheckBox jCheckBoxVPBorrow;
    private javax.swing.JCheckBox jCheckBoxVPLend;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JDesktopPane jDesktopPane2;
    private javax.swing.JDesktopPane jDesktopPane3;
    private javax.swing.JDesktopPane jDesktopPane4;
    private javax.swing.JInternalFrame jInternalFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private com.toedter.calendar.JDateChooser jdcEndDay;
    private com.toedter.calendar.JDateChooser jdcIEDate;
    private com.toedter.calendar.JDateChooser jdcStartDay;
    private javax.swing.JPanel jpASAddDelete;
    private javax.swing.JPanel jpASEdit;
    private javax.swing.JPanel jpASSetPrivilege;
    private javax.swing.JPanel jpASViewPrivilege;
    private javax.swing.JPanel jpAccount;
    private javax.swing.JPanel jpBorrowLend;
    private javax.swing.JPanel jpImportExport;
    private javax.swing.JPanel jpMain;
    private javax.swing.JPanel jpPrivilegeExport;
    private javax.swing.JPanel jpPrivilegeImport;
    private javax.swing.JPanel jpThongKe;
    private javax.swing.JTabbedPane jtpAccount;
    private javax.swing.JLayeredPane layerAccountSettings;
    private javax.swing.JLayeredPane layerBorrowLend;
    private javax.swing.JLayeredPane layerImportExport;
    private javax.swing.JLayeredPane layerMenu;
    private javax.swing.JLayeredPane layerStatistics;
    private javax.swing.JLabel lbTong;
    private javax.swing.JList listPrivilegeExport;
    private javax.swing.JList listPrivilegeImport;
    private javax.swing.JList listVPExportType;
    private javax.swing.JList listVPImportType;
    private javax.swing.JRadioButton rbtChiTieu;
    private javax.swing.JRadioButton rbtThuNhap;
    private javax.swing.JTable tbBangThongKe;
    private javax.swing.JTable tbBorrowLend;
    private javax.swing.JTable tbImportExport;
    private javax.swing.JTextField txtDate2;
    private javax.swing.JTextField txtExpiry;
    private javax.swing.JTextField txtIEImageURL;
    private javax.swing.JTextField txtIEStatus;
    private javax.swing.JTextField txtNote;
    private javax.swing.JTextField txtPartner;
    private javax.swing.JTextField txtRate;
    private javax.swing.JTextField txtStatus;
    private javax.swing.JTextField txtValue;
    private javax.swing.JTextField txtValue2;
    // End of variables declaration//GEN-END:variables
}
